package com.hkbigdata.transform;


import org.apache.flink.api.common.typeinfo.Types;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.util.Collector;


/**
 * @author liuanbo
 * @creat 2023-03-18-12:25
 * @see 2194550857@qq.com
 */
public class Flink02_TransFrom_FlatMap_Lambda {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        env.setParallelism(1);

/*        SingleOutputStreamOperator<Integer> returns = env.fromElements(1, 3, 5)
                .flatMap((Integer data, Collector<Integer> out) -> {
                    out.collect(data * data * data);
                }).returns(Types.INT);

        returns.print();*/

env.fromElements(1,2,4)
        .flatMap((Integer data,Collector<Integer> out)->{
            out.collect(data*data*data);
        }).returns(Types.INT).print();

        env.execute();
    }
}
